Hello,
Do you know if this bug still exists in DOORS 9.0+? Best regards, MattMar SystemAdmin - Mon Nov 02 09:29:14 EST 2009 |
Re: IF Statement bug From the DXL help: "The if statement takes an expression of type bool, which must be in parenthesis. If the expression evaluates to true, it executes the following statement, which can be a block." Can be a block (surrounded by curly braces), but does not have to. Then, for comments: "The characters // start a comment which terminates at the end of the line on which it occurs." So, DXL correctly interprets your code. In the second 'if (false)' example, the statement to be executed in the 'false' case is "tabulator, followed by a comment". Well, this is a strange statement, admittedly, but it is valid. The following compound statement (The 'print "we have the bug"') is just executed in any case, regardless of the if clause. Although this is in my view correct, it is of course easily leading to mistakes. Which is why I have taken the habit to comment if clauses as follows:
Repeating the comment at the opening and closing brackets has become quite useful in longer scripts. Regards, Peter |
Re: IF Statement bug You can see it more clearly if you inserted an 'else' line before each of your 3 openning braces. Doing that, you get the 'no error' print statement, no doubt DXL figured out that there is no 'then' clause and jumps right to the else.
|